package org.skipper.samples.spring.transaction.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.skipper.samples.spring.transaction.config.ExpandBaseMapper;
import org.skipper.samples.spring.transaction.entity.UserInfo;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * <p>
 * 用户详情 Mapper 接口
 * </p>
 *
 * @author skipper
 * @since 2022-01-11
 */
@Component
public interface UserInfoMapper extends ExpandBaseMapper<UserInfo> {

    @Select("select * from user_info where user_id = #{id}")
    Optional<UserInfo> getUserInfo(Long id);

    @Select("update user_info set is_deleted = 0 where user_id = #{userId}")
    Integer recoveryById(Long userId);

    @Select("delete from user_info where user_id = #{userId}")
    Integer delete(Long userId);

}
